#ifndef FROM_H
#define FROM_H

#include <vector>
#include <string>

using namespace std;

// formward declarations.
class FromComponent;

/*
    Class: From
    Represents an SQL From clause.
*/
class From
{
    /* Section: public */
    public:
        /*
            Destructor: Default destructor.
            Destroy the object.

        */
        virtual ~From();

        /*
            Constructor: Copy constructor.
            Initializes the object as a copy of other From object.

            Parameters:
                other   -   From object to copy from.
        */
        From(const From& other);

        /*
            Constructor: Parametrized constructor.
            Initializes the object with the given parameters.

            Parameters:
                components  -   vector of FromComponent
        */
        From(vector<FromComponent *> * components = NULL);

        /*
            Method: AddFromComponent
            Adds a FromComponent to the From object.

            Parameters:
                component   - FromComponent to add.
        */
        void addFromComponent(FromComponent * component);

        /*
            Method: SetComponents
            Sets the FromComponent objects of the From object. Destroy the previous components if any.

            Parameters:
                components  -   vector of FromComponent to set.
        */
        void setComponents(vector<FromComponent *> * components);

        /*
            Method: GetComponents
            Returns:
                The components of the From objects.
        */
        vector<FromComponent *> * getComponents() const;

        /*
            Method: ToString
            Returns:
                A string representation of the From object.
        */
        string toString();

        /*
            Method: clone
            Returns:
                A clone of this object.
        */
        From * clone();

    /* Section: private */
    private:
        /*
            Variable: components
            Type: vector<FromComponent *> *
            vector of FromComponent objects.
        */
        vector<FromComponent *> * components;
};

#endif // FROM_H
